﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NewLife.Log;
using NewLife.Web;
using NewsPub;
using NewLife.CommonEntity;

public partial class NewsPub_CommunicateForm : MyEntityForm<Communicate>
{
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        //EntityForm.OnSetForm += EntityForm_OnSetForm;
        EntityForm.OnGetForm += EntityForm_OnGetForm;
        //EntityForm.OnSaveSuccess += EntityForm_OnSaveSuccess;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    void EntityForm_OnGetForm(object sender, EntityFormEventArgs e)
    {

        if (Entity.ID > 0) Entity.ReplyTime = DateTime.Now;
    }
    void EntityForm_OnSetForm(object sender, EntityFormEventArgs e)
    {
        ////判断插入还是更新
        //if (Entity.ID > 0) { frmEditTime.Text = DateTime.Now.ToString(); isAdd = false; }
        //else
        //{
        //    frmCreateTime.Text = frmEditTime.Text = DateTime.Now.ToString();
        //    frmUserID.Text = Manager.Current.ID.ToString();
        //    isAdd = true;
        //}
        //if (Entity.ID > 0) Entity.EditTime = DateTime.Now;
        foreach (Classis c in Classis.FindAllChildsByParent(45))
        {
            if (c.Childs.Count > 0 || c.Name == "首页")
            {
                ListItem i = frmClassisID.Items.FindByValue(c.ID.ToString());

                i.Attributes.Add("style", "color:gray;");

                i.Attributes.Add("disabled", "true");
            }
        }
        //ListItem i = frmClassisID.Items.FindByValue("0");

        //    i.Attributes.Add("style", "color:gray;");

        //    i.Attributes.Add("disabled", "true");

        //    i.Value = "-1";
    }
}